/**
*  \file switch.h
*
*  \brief
*
*  \author Dajin Li
*
*
*/
/*===============================================[ private includes  ]================================================*/


#ifndef __SWITCH_H_
#define __SWITCH_H_

/*================================================[ public includes  ]================================================*/

#include "stm32f10x.h"
#include "global.h"
/*================================================[ public datatypes ]================================================*/


/*================================================[ public defines   ]================================================*/
#define SEAT_IN                              BIT1   // P21, normal high, seat switch input
#define AREA_CTRL_SWITCH_IN                  BIT5   // P12, normal low, area speed ctrl switch in 

#define ENTER_KEY_IN                         BIT17
#define UP_KEY_IN                            BIT18
#define DOWN_KEY_IN                          BIT19
#define BACK_KEY_IN                          BIT20

/*On the dash board*/
/*"Key1(+)" 	------  KEY4*/
/*"Key2(-)" 	------  KEY3*/
/*"Key3( )" 	------  KEY2*/
/*"Key4(SET)" 	------  KEY1*/
#define KEY1_IN                          BIT0
#define KEY2_IN                          BIT1
#define KEY3_IN                          BIT2
#define KEY4_IN                          BIT3
#define KEY_SWITCH_IN					 BIT4

#define KEY1_PORT            GPIOB
#define KEY1_PIN             GPIO_Pin_3
#define KEY2_PORT            GPIOD
#define KEY2_PIN             GPIO_Pin_2
#define KEY3_PORT            GPIOC
#define KEY3_PIN             GPIO_Pin_12
#define KEY4_PORT            GPIOC
#define KEY4_PIN             GPIO_Pin_11
#define KEY_SWITCH_PORT      GPIOA
#define KEY_SWITCH_PIN       GPIO_Pin_10
#define GET_KEY1() 		 	 GPIO_ReadInputDataBit(KEY1_PORT, KEY1_PIN)
#define GET_KEY2()  		 GPIO_ReadInputDataBit(KEY2_PORT, KEY2_PIN)
#define GET_KEY3() 			 GPIO_ReadInputDataBit(KEY3_PORT, KEY3_PIN)
#define GET_KEY4() 			 GPIO_ReadInputDataBit(KEY4_PORT, KEY4_PIN)
#define GET_KEY_SWITCH() 	 GPIO_ReadInputDataBit(KEY_SWITCH_PORT, KEY_SWITCH_PIN)

/*================================================[ public variables ]================================================*/


extern u32 switches_current;
extern int Switches_Ready;	
extern u16 kwp_input;
extern u16 kwp_input_1219;



/*================================================[ inline functions ]================================================*/

/*================================================[ public functions ]================================================*/
extern U32 get_switches(void);

#endif
/***********************************************************************************************************************
*                             Copyright 2016 Linde Material Handling. All rights reserved.                             *
***********************************************************************************************************************/

